
/* 节流函数: 头部执行 */
export default function (fn, delay = 500) {
    let timerId = null;
    return function (...args) {
        if (timerId) return;
        fn.apply(this, args);
        timerId = setTimeout(() => {
            timerId = null;
        }, delay)
    }
}